package zheezes.eisp.data.orm;

import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

import zheezes.util.ConstantUtil;


@SuppressWarnings({ "rawtypes", "unchecked" })
public class CalcTask {
	public static final int TASK_CALC_USE = 1;
	public static final int TASK_CALC_LOSSY = 2;
	public static final int TASK_CALC_GROUP_STAT = 3;
	
	public static final int TARGET_GROUP = 3;
	public static final int TARGET_ZONE = 5;
	public static final int TARGET_CONCENTRATOR = 10;
	public static final int TARGET_SUMMETER = 15;
	public static final int TARGET_RESMETER = 20;
	
	public static final int STATUS_FINISH = 0;
	public static final int STATUS_QUEUE = 1;
	
	public static final int SOURCE_MANUAL = 0;
	public static final int SOURCE_AUTO = 1;
	
	private static Map<Integer, String> descs = new HashMap<Integer, String>();
	
	static {
		Collection<Class> types = new HashSet<Class>();
		types.add(Integer.TYPE);
		descs.putAll(ConstantUtil.vmap(CalcTask.class, types, ".*TASK"));
	}
	
	private Integer id;
	private Integer taskType;
	private Integer targetType;
	private Integer targetId;
	private Integer status;
	private Integer source;
	private Date date;
	private Date createDate;
	
	public String desc() {
		return descs.get(taskType);
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getTaskType() {
		return taskType;
	}

	public void setTaskType(Integer taskType) {
		this.taskType = taskType;
	}

	public Integer getTargetType() {
		return targetType;
	}

	public void setTargetType(Integer targetType) {
		this.targetType = targetType;
	}

	public Integer getTargetId() {
		return targetId;
	}

	public void setTargetId(Integer targetId) {
		this.targetId = targetId;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getSource() {
		return source;
	}

	public void setSource(Integer source) {
		this.source = source;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = (Date) createDate.clone();
	}
}
